// 将obj转字符串className
export const classnames = (obj) => {
  let arr = []
  Object.keys(obj).forEach(k => {
    if (obj[k]) {
      arr.push(k)
    }
  })
  return arr.join(' ')
}

export const flattenArr = (arr) => {
  return arr.reduce((map, item) => {
    map[item.id] = item
    return map
  }, {})
}

export const objToArr = (obj) => {
  return Object.keys(obj).map(k => obj[k])
}